$(document).ready(function() {
	//注册ajax
	$(".reg_c").on("blur", ".l_user", function() {
		var userName = $("#l_user").val();
		if (userName == null || userName == "") {
			alert("用户名不能为空");
		} else {
			$.ajax({
				"url" : "Servlet/UserServlet",
				"type" : "post",
				"data" : "opr=userName&l_user=" + userName,
				"dataType" : "JSON",
				"success" : user
			});
			function user(data) {
				if (data[0].status == "error") {
					alert(data[0].hint);
					$(".l_user").css("border-color","red");
					$("#l_user").val("");
				} else if (data[0].status == "success") {

				}
			}
		}

	});
	$(".reg_c").on("blur", "#l_pwd2", function() {
		var pwd = $("#l_pwd").val();
		var pwd2 = $("#l_pwd2").val();
		if (pwd == null || pwd == "") {
			alert("密码不能为空");
		} else {
			if (pwd != pwd2) {
				alert("两次输入密码不相同");
			}
		}
	});
	$(".reg_c").on("blur", ".l_email", function() {
		var email = $(".l_email").val();
		if (email == null || email == "") {
			alert("邮箱不能为空");
		} 
	});
	$(".reg_c").on("blur", ".l_tel", function() {
		var tel = $(".l_tel").val();
		if (tel == null || tel == "") {
			alert("手机号不能为空");
		} 
	});

});
